﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;

namespace OracleDAL.ResourceManage
{
    /// <summary>
    /// 资源添加
    /// </summary>
    public class ResAdd
    {
       /// <summary>
       /// 确定要添加的列
       /// </summary>
       /// <param name="strWhere"></param>
       /// <returns></returns>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select TABLENAME,ISRAGATORY,ISSTATISTIC,SERIAL,GETRULE,ISADDITIVEINTO,ISEDITABLEINTO,CODEINPUTINTO,CHANGESETNULL,CUSTOMSELECT,TREEBRANCHTYPES,ENFIELD,TREEROOTRESID,REMARK,ISTRANSITION,TRANSTABLE,TRANSCOL,TRANSEDCOL,VALUETYPE,ISAUTOCODE,PUBLICVISIBLE,CHFIELD,ISKEY,DATATYPE,ISNULL,ISVISIBLE,ISEDITABLE,ISADDITIVE ");
            strSql.Append(" FROM CFG_RESOURCE_FIELDS ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DBUtility.OracleHelper.Query(strSql.ToString());

        }
        public Model.ResourceManage.ResAdd GetExcutState(string strSqlInsert)
        {
            Model.ResourceManage.ResAdd model = new Model.ResourceManage.ResAdd();
           
            //OracleParameter[] parameters = {
            //        new OracleParameter("sqlinsert", OracleType.VarChar,1024),new OracleParameter("issucces",OracleType.VarChar,10)};
            //parameters[0].Value = strSqlInsert;
            //parameters[1].Direction = ParameterDirection.Output;
            //int getresult;
            //DBUtility.OracleHelper.RunProcedure("com_insert_proc", parameters, out getresult);
            //model.GetResult = getresult;
            //return model;

           int temp = DBUtility.OracleHelper.ExecuteSql(strSqlInsert);
           model.GetResult = temp;
           return model;
        }
    }
}
